"""author: wangxin
   data: 2021/11/21
   project: 王鑫 下载图片.py
"""

import random
d1 = {}
with open("ips.txt", "w") as file:

    for i in range(120000):
        num = random.randint(1, 256)
        file.write(f"172.25.254.{num}"+'\n')

with open("ips.txt", 'r') as file:
    lst = file.readlines()

for i in lst:
    if i in d1:
        d1[i] += 1
    else:
        d1[i] = 1

ip = sorted(d1.items(),
            key=lambda x: x[1], reverse=True)[:10]

print("ip出现前十的是", ip)





